package com.d3works.apps.account.service;

import com.d3works.apps.account.db.Account;
import com.d3works.apps.account.db.AccountManagement;
import com.d3works.apps.account.db.AnalyticDistributionTemplate;
import com.d3works.apps.account.db.FiscalPosition;
import com.d3works.apps.account.db.FixedAssetCategory;
import com.d3works.apps.account.db.Journal;
import com.d3works.apps.account.db.PaymentMode;
import com.d3works.apps.account.db.Tax;
import com.d3works.apps.base.db.Company;
import com.d3works.apps.base.db.Product;
import com.d3works.apps.base.service.tax.AccountManagementService;
import com.d3works.exception.D3worksException;

public interface AccountManagementAccountService extends AccountManagementService {

  /**
   * Get the product tax according to the fiscal position
   *
   * @param product
   * @param company
   * @param fiscalPosition
   * @param isPurchase Specify if we want get the tax for purchase or sale
   * @param fixedAsset Specify if we should get the purchase account for fixed asset or not. Used
   *     only if isPurchase param is true.
   * @return the tax defined for the product, according to the fiscal position
   * @throws D3worksException
   */
  public Account getProductAccount(
      Product product,
      Company company,
      FiscalPosition fiscalPosition,
      boolean isPurchase,
      boolean fixedAsset)
      throws D3worksException;

  /**
   * Get the product analytic distribution template
   *
   * @param product
   * @param company
   * @return
   * @throws D3worksException
   */
  public AnalyticDistributionTemplate getAnalyticDistributionTemplate(
      Product product, Company company, boolean isPurchase) throws D3worksException;

  /**
   * Get the product fixed asset category
   *
   * @param product
   * @param company
   * @return
   * @throws D3worksException
   */
  public FixedAssetCategory getProductFixedAssetCategory(Product product, Company company);

  public Account getCashAccount(AccountManagement accountManagement, PaymentMode paymentMode)
      throws D3worksException;

  public Account getPurchVatRegulationAccount(
      AccountManagement accountManagement, Tax tax, Company company) throws D3worksException;

  public Account getSaleVatRegulationAccount(
      AccountManagement accountManagement, Tax tax, Company company) throws D3worksException;

  public Account getTaxAccount(
      AccountManagement accountManagement,
      Tax tax,
      Company company,
      Journal journal,
      int vatSystemSelect,
      int functionalOrigin,
      boolean isFixedAssets,
      boolean isFinancialDiscount)
      throws D3worksException;
}
